package com.bienvenue.main.serviceApi;

import com.bienvenue.main.model.AddSubAccountModel;
import com.bienvenue.main.model.AreaTreeModel;
import com.bienvenue.main.model.EnterprisePwdLoginModel;
import com.bienvenue.main.model.HotJobPositionModel;
import com.bienvenue.main.model.HotPromptModel;
import com.bienvenue.main.model.HttpBean;

import com.bienvenue.main.model.InformationPerfectionModel;
import com.bienvenue.main.model.JobManagerListModel;
import com.bienvenue.main.model.JobPostModel;
import com.bienvenue.main.model.PostJobModel;
import com.bienvenue.main.model.PwdLoginModel;
import com.bienvenue.main.model.ResumeInfoModel;
import com.bienvenue.main.model.SaveResumeModel;

import io.reactivex.Observable;

import okhttp3.MultipartBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;

import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Query;


/**
 * @ProjectName: Bienvenue
 * @Package: com.bienvenue.main.serviceApi
 * @ClassName: ApiService
 * @Description: java类作用描述
 * @Author: Mr.Chen
 * @CreateDate: 2020/9/7 9:46
 * @UpdateUser: Mr.Chen
 * @UpdateDate: 2020/9/7 9:46
 * @UpdateRemark: 接口请求的地址
 * @Version: 1.0
 */
public interface ApiService {


    /**
     * 个人注册
     *
     * @param userName
     * @param pwd
     * @param phone
     * @return
     */
    @FormUrlEncoded
    @PUT("register")
    Observable<HttpBean> register(
            @Field("username") String userName,
            @Field("password") String pwd,
            @Field("phone") String phone
    );

    /**
     * 个人登录
     *
     * @param userName
     * @param pwd
     * @return
     */
    @FormUrlEncoded
    @POST("login")
    Observable<PwdLoginModel> onPwdLogin(
            @Field("username") String userName,
            @Field("password") String pwd


    );

    /**
     * 个人端手机号密码登录
     *
     * @param phone
     * @param code
     * @return
     */
    @FormUrlEncoded
    @POST("login")
    Observable<HttpBean> onCodeLogin(
            @Field("phone") String phone,
            @Field("code") String code
    );

    /**
     * 获取验证码
     *
     * @param phone
     * @return
     */
    @GET("getCode")
    Observable<HttpBean> onSuperCode(
            @Query("phone") String phone
    );

    /**
     * 上传图片
     *
     * @param file
     * @return
     */
    @Multipart
    @POST("setImg")
    Observable<HttpBean> setImg(
            @Part MultipartBody.Part file
    );

    /**
     * 验证公司名称是否已经注册
     *
     * @param companyName
     * @return
     */
    @FormUrlEncoded
    @POST("c-company/vaildCompanyName")
    Observable<HttpBean> onVaildCompanyName(
            @Field("companyname") String companyName
    );

    /**
     * 企业注册
     *
     * @param conpanyName
     * @param phone
     * @param password
     * @param code
     * @return
     */
    @FormUrlEncoded
    @PUT("c-company")
    Observable<HttpBean> onEnterpriseRegister(
            @Field("companyname") String conpanyName,
            @Field("phone") String phone,
            @Field("password") String password,
            @Field("code") String code,
            @Field("companylogin") String companylogin,
            @Field("qualificationPic") String logo
    );

    /**
     * 企业用户名密码登录
     *
     * @param companyName
     * @param pwd
     * @return
     */
    @FormUrlEncoded
    @POST("c-company/login")
    Observable<EnterprisePwdLoginModel> onEnterprisePwdLogin(
            @Field("companylogin") String companyName,
            @Field("password") String pwd
    );

    /**
     * 企业用户手机号验证码登录
     *
     * @param phone
     * @param code
     * @return
     */
    @FormUrlEncoded
    @POST("c-company/login")
    Observable<HttpBean> onEnterpriseCodeLogin(
            @Field("phone") String phone,
            @Field("code") String code
    );

    /**
     * 行业信息
     *
     * @return
     */
    @GET("industry/getTree")
    Observable<HttpBean> getTree();

    /**
     * 获取地区
     *
     * @return
     */
    @GET("sysAreas/getTreeArea")
    Observable<AreaTreeModel> getTreeArea();

    /**
     * 获取工作年限
     *
     * @return
     */
    @GET("c-company-postjob/getListByType?type=work_years")
    Observable<JobPostModel> getListByTypeWorkYears();

    /**
     * 期望薪资
     *
     * @return
     */
    @GET("c-company-postjob/getListByType?type=positionSalary")
    Observable<JobPostModel> getListByTypePositionSalary();

    /**
     * 学历
     *
     * @return
     */
    @GET("c-company-postjob/getListByType?type=educate")
    Observable<JobPostModel> getListByTypeEducate();

    /**
     * 福利标签
     *
     * @return
     */
    @GET("c-company-postjob/getListByType?type=corporateWelfare")
    Observable<JobPostModel> getListByCorporateWelfare();

    /**
     * 到岗时间
     *
     * @return
     */
    @GET("c-company-postjob/getListByType?type=time-arrival")
    Observable<JobPostModel> getListByTimeArrival();

    /**
     * 求职状态
     *
     * @return
     */
    @GET("c-company-postjob/getListByType?type=workStatus")
    Observable<JobPostModel> getListByWorkStatus();

    /**
     * 发布职位
     *
     * @param bean
     * @return
     */
    @PUT("c-company-postjob")
    Observable<HttpBean> onPostJob(
            @Body PostJobModel bean
    );


    /**
     * 职位管理列表
     *
     * @param token
     * @return
     */
    @GET("c-company-postjob/getList")
    Observable<JobManagerListModel> onGetJobList(
            @Query("token") String token
    );

    /**
     * 上传简历
     *
     * @param file
     * @return
     */
    @Multipart
    @PUT("u-resume-attachment")
    Observable<HttpBean> putDocOrPdf(
            @Part MultipartBody.Part file
    );

    /**
     * 保存工作经验
     *
     * @param workYearsModel
     * @return
     */
    @PUT("u-resume-work")
    Observable<HttpBean> onSaveResumeWorkingYears(
            @Body SaveResumeModel.WorkYearsModel workYearsModel
    );

    /**
     * 保存教育背景
     *
     * @param educationModel
     * @return
     */
    @PUT("u-resume-education")
    Observable<HttpBean> onSaveResumeEducation(
            @Body SaveResumeModel.EducationModel educationModel
    );

    /**
     * 项目经验
     *
     * @param projectExperienceModel
     * @return
     */
    @PUT("u-resume-experience")
    Observable<HttpBean> onSaveResumeProjectExperience(
            @Body SaveResumeModel.ProjectExperienceModel projectExperienceModel
    );

    /**
     * 求值意向
     *
     * @param model
     * @return
     */
    @PUT("u-resume-jobhunting")
    Observable<HttpBean> onSaveResumeJobHunting(
            @Body SaveResumeModel.JobHuntingModel model
    );

    /**
     * 技能证书
     *
     * @param model
     * @return
     */
    @PUT("u-resume-certificate")
    Observable<HttpBean> onSaveResumeCertificate(
            @Body SaveResumeModel.CertificateModel model
    );

    /**
     * 个人特长
     *
     * @param model
     * @return
     */
    @PUT("u-resume-progress")
    Observable<HttpBean> onSaveResumeProgress(
            @Body SaveResumeModel.ProgressModel model
    );

    /**
     * 获取简历信息的功能
     *
     * @param userId
     * @return
     */
    @GET("u-resume-info")
    Observable<ResumeInfoModel> getResumeInfo(
            @Query("userid") String userId
    );

    /**
     * 个人在线简历信息保存
     *
     * @param model
     * @return
     */
    @PUT("u-resume-info")
    Observable<HttpBean> putResumeInfo(
            @Body SaveResumeModel.ResumeInfoModel model
    );

    /**
     * 删除求职意向
     *
     * @param userId
     * @return
     */
    @DELETE("u-resume-jobhunting")
    Observable<HttpBean> deleteResumeJobHunting(
            @Query("id") String userId
    );

    /**
     * 删除项目经历
     *
     * @param userId
     * @return
     */
    @DELETE("u-resume-experience")
    Observable<HttpBean> deleteResumeExperience(
            @Query("id") String userId
    );

    /**
     * 删除工作经历
     *
     * @param userId
     * @return
     */
    @DELETE("u-resume-work")
    Observable<HttpBean> deleteResumeWork(
            @Query("id") String userId
    );

    /**
     * 删除教育背景
     *
     * @param userId
     * @return
     */
    @DELETE("u-resume-education")
    Observable<HttpBean> deleteEducation(
            @Query("id") String userId
    );

    /**
     * 删除个人特长
     *
     * @param id
     * @return
     */
    @DELETE("u-resume-progress")
    Observable<HttpBean> deleteProgress(
            @Query("id") String id
    );

    /**
     * 热门公司
     *
     * @param page
     * @param limit
     * @return
     */
    @FormUrlEncoded
    @POST("c-company/popularCompanies?")
    Observable<HotPromptModel> popularCompanies(
            @Field("page") int page,
            @Field("limit") int limit
    );

    /**
     * 热门职位
     *
     * @param page
     * @param limit
     * @return
     */
    @FormUrlEncoded
    @POST("c-company-postjob/getPopularPositions?")
    Observable<HotJobPositionModel> getPopularPositions(
            @Field("page") int page,
            @Field("limit") int limit
    );

    /**
     * 删除技能证书
     *
     * @param id
     * @return
     */
    @DELETE("u-resume-certificate")
    Observable<HttpBean> deleteCertificate(
            @Query("id") String id
    );

    /**
     * 企业用户退出登录
     *
     * @param id
     * @return
     */
    @DELETE("c-company")
    Observable<HttpBean> enterpriseLoginOut(
            @Query("id") String id
    );

    /**
     * 个人用户退出登录
     *
     * @param id
     * @return
     */
    @DELETE(".")
    Observable<HttpBean> personalLoginOut(
            @Query("id") String id
    );

    /**
     * 企业规模
     *
     * @return
     */
    @GET("c-company-postjob/getListByType?type=companySize")
    Observable<JobPostModel> getListByCompanySize();

    /**
     * 企业性质
     *
     * @return
     */
    @GET("c-company-postjob/getListByType?type=companyNature")
    Observable<JobPostModel> getListByTypeCompanyNature();

    /**
     * 所属行业
     *
     * @return
     */
    @GET("c-company-postjob/getListByType?type=industry")
    Observable<JobPostModel> getListByTypeIndustry();

    /**
     * 保存企业信息
     *
     * @param bean
     * @return
     */
    @PUT("company-information-perfection")
    Observable<HttpBean> putInformationPerfection(
            @Body HttpBean.ParamRegisterBean bean
    );

    /**
     * 添加子账号
     *
     * @return
     */
    @FormUrlEncoded
    @PUT("c-company-subaccount")
    Observable<HttpBean> putSubAccount(
            @Field("phone") String phone,
            @Field("code") String pwd,
            @Field("companyid") String companyId,
            @Field("password")String password,
            @Field("username")String userName
            );

    /**
     *获取企业完善的信息
     * @param companyID
     * @return
     */
    @GET("company-information-perfection")
    Observable<InformationPerfectionModel> getInformationPerfection(
            @Query("companyId")String companyID
    );


}
